<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <style>
        thead tr th{text-align: center!important;font-weight: bold!important;}
        tr td{text-align: center!important;}
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="test-table-reload-btn layui-col-sm-offset10" style="margin-bottom: 10px;">
                        <button class="layui-btn editThis" type="button" style="margin-left: 10px" data-id="">新增银行卡类型</button>
                    </div>
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th width="5%">ID</th>
                            <th width="15%">国家</th>
                            <th width="15%">银行名称</th>
                            <th width="10%">logo</th>
                            <th width="10%">状态</th>
                            <th width="15%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list}" var="l">
                            <tr>
                                <td>${l.id}</td>
                                <td>${l.countryId}</td>
                                <td>${l.bankName}</td>
                                <td>
                                    <img src="${l.logo}" style="width: 50px;height: 50px">
                                </td>
                                <td>${l.status==1?'有效':'无效'}</td>
                                <td class="td-manage">
                                    <button data-id="${l.id}" data-type="editThis" class="layui-btn layui-btn-sm layui-btn-primary editThis">编辑</button>
                                    <button data-id="${l.id}" data-type="delThis" class="layui-btn layui-btn-sm layui-btn-danger delThis">删除</button>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script>
    layui.config({
        //静态资源所在路径
        base: '/layuiadmin/'
    }).extend({
        //主入口模块
        index: 'lib/index'
    }).use(['index', 'laydate'], function(){
        var $ = layui.$,
            admin = layui.admin,
            element = layui.element,
            layer = layui.layer;
        element.render();

        var active = {
            editThis: function (id) {
                layer.open({
                    title:'新增/编辑银行卡类型',
                    type: 2,
                    area: ['550px', '480px'],
                    content: '/cash/bankEdit?id='+id
                });
            },
            delThis:function (id,url) {
                layer.confirm('确定删除吗？', function(){
                    delThis(id,url);
                });
            }
        };
        $('.editThis').on('click', function(){
            var type = 'editThis';
            var id = $(this).data('id');
            active[type] && active[type].call(this,id);
        });
        $('.delThis').on('click',function () {
            var delType = $(this).data('type');
            var id = $(this).data('id');
            var url = "/cash/deleteBankById";
            active[delType] && active[delType].call(this,id,url);
        });
    });
</script>
</body>
</html>